#include "Player.h"

#include "../wrappers/CSGD_DirectInput.h"
#include "CEvent.h"


CPlayer::CPlayer(void)
{
}


CPlayer::CPlayer( int HP, int AD, int AR, float AS, float MS, float HS )
	: CBaseCharacter( HP, AD, AR, AS, MS, HS, CHAR_PLAYER )
{
	SetCharType( CHAR_PLAYER );

	m_pDI	= CSGD_DirectInput::GetInstance();
}


CPlayer::~CPlayer(void)
{
}


void CPlayer::Update( float fElapsedTime )
{
#if 1 // User Input

	
	
	if( this->IsGrounded() )
	{
		tVector3D tZero = { 0.0, 0.0, 0.0 };
		SetMoveDir( tZero );
		if( m_pDI->KeyDown( DIK_W ) == true )
			SetZMoveDir( -1.0f );
		if( m_pDI->KeyDown( DIK_S ) == true )
			SetZMoveDir( 1.0f );
		if( m_pDI->KeyDown( DIK_D ) == true )
			SetXMoveDir( 1.0f );
		if( m_pDI->KeyDown( DIK_A ) == true )
			SetXMoveDir( -1.0f );
	}
	else 
	{
		if( GetMoveDir().fX > 1.0f ) SetXMoveDir( 1.0f );
		if( GetMoveDir().fX < -1.0f ) SetXMoveDir( -1.0f );
		if( GetMoveDir().fY > 1.0f ) SetYMoveDir( 1.0f );
		if( GetMoveDir().fY < -1.0f ) SetYMoveDir( -1.0f );
		if( GetMoveDir().fZ > 1.0f ) SetZMoveDir( 1.0f );
		if( GetMoveDir().fZ < -1.0f ) SetZMoveDir( -1.0f );
	}


	if( m_pDI->KeyPressed( DIK_SPACE ) == true )
	{
		Jump( 1300.0f );
	}
		


#endif

	CBaseCharacter::Update( fElapsedTime );
}


void CPlayer::Render( void )
{

}


void CPlayer::HandleEvent( CEvent* pEvent )
{
	CBaseCharacter::HandleEvent(pEvent);
}


